<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    if (session.getAttribute("LoginedManagementName") == null){
        request.getRequestDispatcher("LoginForm.jsp").forward(request,response);
        return;
    }
%>
<h1>查询学生档案信息</h1><br/>
<a href="index1.jsp">返回</a>
<hr>
<table border="1" width="100%" >
    <center>
        <tr>
            <th width="40">序号</th>
            <th width="40">学号</th>
            <th width="40">姓名</th>
            <th width="40">性别</th>
            <th width="40">年龄</th>
            <th width="40">年级</th>
            <th width="40">班级</th>
            <th width="40">专业</th>
        </tr>
        <%
            String userid = request.getParameter("userid");
            Class.forName("com.mysql.cj.jdbc.Driver");
            Connection con=DriverManager.getConnection(
                    "jdbc:mysql://127.0.0.1:3307/file?useSSL=FALSE&serverTimezone=UTC"
                    , "root", "123456");
            Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
            ResultSet rs=st.executeQuery("select user_id,user_name,gender,age,grade,banji,major from student where user_id='"+userid+"'");
            int count=1;
            while(rs.next()){
                out.print("<tr>");
                out.print("<td>"+(count++)+"</td>");
                out.print("<td>"+rs.getString("user_id")+"</td>");
                out.print("<td>"+rs.getString("user_name")+"</td>");
                out.print("<td>"+rs.getString("gender")+"</td>");
                out.print("<td>"+rs.getInt("age")+"</td>");
                out.print("<td>"+rs.getInt("grade")+"</td>");
                out.print("<td>"+rs.getInt("banji")+"</td>");
                out.print("<td>"+rs.getString("major")+"</td>");
                out.print("</tr>");
            }
        %>
    </center>
</table>
<%@include file="footer.jsp" %>
</body>
</html>


